/*
 * Created on November 6, 2007
 *
 * Copyright (c) Patrick Armstrong 2002-2007. All Rights Reserved.
 */
package org.dime.mine.game.actions;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
 * ReversibleProcess // TODO Add type summary
 * 
 * @author Owner
 */
public abstract class ReversibleProcess extends Process implements Reversible
{
    private final List<Reversible> reversibles = new LinkedList<Reversible>();

    public ReversibleProcess(List<Reversible> executables)
    {
        super(executables);
        this.reversibles.addAll(executables);
        Collections.reverse(this.reversibles);
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.dime.mine.game.actions.Reversible#undo()
     */
    @Override
    public void undo()
    {
        for (Reversible reversible : reversibles)
        {
            reversible.undo();
        }
    }
}
